package com.xiaoran.rabbitmq.demo.Produce;

import com.xiaoran.rabbitmq.demo.config.Confir_Config;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/confirm")
public class Confire_Queue_Produec {

    @Autowired
    private RabbitTemplate rabbitTemplate;
    //发布确认消息高级
    @GetMapping("/sendMessage/{message}")
    public void sendMessage(@PathVariable String message){
        CorrelationData correlationData=new CorrelationData();
        correlationData.setId("1");
        rabbitTemplate.convertAndSend(Confir_Config.confire_exchange_name,Confir_Config.confire_routing_key+"1",message,correlationData);
        System.out.println("发送消息内容为："+message);
    }
}
